<template>
    <div></div>
</template>

<script>
import { ElMessage } from 'element-plus'
import {ref, watch} from 'vue'
export default {
    name: "PlugMessage",
    setup(){
        let isShow = ref(false)
        let msg = ref('操作成功！')
        let type = ref('success')
        watch(isShow,(oldVal, newVal) => {
            if(oldVal){
                ElMessage({
                    message:msg.value,
                    type:type.value
                })
            }
        })
        return{
            isShow,
            msg,
            type
        }
    }
}
</script>